package br.com.vm.dijkstra.graph;

import java.util.List;

public class Vertice implements Comparable<Vertice> {

	public final String nomeNoh;
	public List<Aresta> adjacentes;
	public double distanciaMinima = Double.POSITIVE_INFINITY;
	public Vertice verticeAnterior;

	public Vertice(String psNomeNoh) {
		nomeNoh = psNomeNoh;
	}

	public String toString() {
		return nomeNoh;
	}

	public int compareTo(Vertice other) {
		return Double.compare(distanciaMinima, other.distanciaMinima);
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((nomeNoh == null) ? 0 : nomeNoh.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Vertice other = (Vertice) obj;
		if (nomeNoh == null) {
			if (other.nomeNoh != null)
				return false;
		} else if (!nomeNoh.equals(other.nomeNoh))
			return false;
		return true;
	}

	public List<Aresta> getAdjacentes() {
		return adjacentes;
	}

	public void setAdjacentes(List<Aresta> adjacentes) {
		this.adjacentes = adjacentes;
	}

	public double getDistanciaMinima() {
		return distanciaMinima;
	}

	public void setDistanciaMinima(double distanciaMinima) {
		this.distanciaMinima = distanciaMinima;
	}

	public Vertice getVerticeAnterior() {
		return verticeAnterior;
	}

	public void setVerticeAnterior(Vertice verticeAnterior) {
		this.verticeAnterior = verticeAnterior;
	}

	public String getNomeNoh() {
		return nomeNoh;
	}

}
